package com.codepilot.server.model.entity;

import java.io.Serializable;
import com.codepilot.server.model.vo.DisplayUserVO;
import com.codepilot.server.model.vo.RegisterUserVO;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class User implements Serializable {

    private Integer id;
    private String username;
    private String password;
    private String character;
    private String status;
    private String avatar;
    private String birthday;
    private String gender;
    private String job;
    private String phone;
    private String email;
    private String registerTime;
    private String lastLoginTime;
    private Boolean deleted;

    public User(RegisterUserVO registerUserVO) {
        this.username = registerUserVO.getUsername();
        this.password = registerUserVO.getPassword();
        this.birthday = registerUserVO.getBirthday();
        this.gender = registerUserVO.getGender();
        this.job = registerUserVO.getJob();
        this.email = registerUserVO.getEmail();
        this.phone = registerUserVO.getPhone();
    }

    public void update(DisplayUserVO displayUserVO) {
        this.avatar = displayUserVO.getAvatar();
        this.birthday = displayUserVO.getBirthday();
        this.job = displayUserVO.getJob();
        this.phone = displayUserVO.getPhone();
        this.email = displayUserVO.getEmail();
    }

}
